package com.czkt.service.impl;

import java.util.List;

import com.czkt.domain.ErpPurchase;
import com.czkt.mapper.ErpPurchaseMapper;
import com.czkt.service.IErpPurchaseService;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 请购单Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-05-21
 */
@Service
public class ErpPurchaseServiceImpl implements IErpPurchaseService
{
    @Autowired
    private ErpPurchaseMapper erpPurchaseMapper;

    /**
     * 查询请购单
     * 
     * @param id 请购单主键
     * @return 请购单
     */
    @Override
    public ErpPurchase selectErpPurchaseById(Long id)
    {
        return erpPurchaseMapper.selectErpPurchaseById(id);
    }

    /**
     * 查询请购单列表
     * 
     * @param erpPurchase 请购单
     * @return 请购单
     */
    @Override
    public List<ErpPurchase> selectErpPurchaseList(ErpPurchase erpPurchase)
    {
        return erpPurchaseMapper.selectErpPurchaseList(erpPurchase);
    }

    /**
     * 新增请购单
     * 
     * @param erpPurchase 请购单
     * @return 结果
     */
    @Override
    public int insertErpPurchase(ErpPurchase erpPurchase)
    {
        erpPurchase.setCreateTime(DateUtils.getNowDate());
        return erpPurchaseMapper.insertErpPurchase(erpPurchase);
    }

    /**
     * 修改请购单
     * 
     * @param erpPurchase 请购单
     * @return 结果
     */
    @Override
    public int updateErpPurchase(ErpPurchase erpPurchase)
    {
        return erpPurchaseMapper.updateErpPurchase(erpPurchase);
    }

    /**
     * 批量删除请购单
     * 
     * @param ids 需要删除的请购单主键
     * @return 结果
     */
    @Override
    public int deleteErpPurchaseByIds(Long[] ids)
    {
        return erpPurchaseMapper.deleteErpPurchaseByIds(ids);
    }

    /**
     * 删除请购单信息
     * 
     * @param id 请购单主键
     * @return 结果
     */
    @Override
    public int deleteErpPurchaseById(Long id)
    {
        return erpPurchaseMapper.deleteErpPurchaseById(id);
    }
}
